		TITLE	ENTRYNAME - Copyright (C) 1994 SLR Systems

		INCLUDE	MACROS
		INCLUDE	SEGMSYMS

if	fg_segm OR fg_pe

		PUBLIC	INSTALL_ENTRYNAME


		.DATA

		EXTERNDEF	SYMBOL_TEXT:BYTE

		EXTERNDEF	ENTRYNAME_BITS:DWORD,SYMBOL_LENGTH:DWORD,FIRST_ENTRYNAME_GINDEX:DWORD,LAST_ENTRYNAME_GINDEX:DWORD
		EXTERNDEF	ENTRYNAME_COUNT:DWORD

		EXTERNDEF	ENTRYNAME_GARRAY:STD_PTR_S,ENTRYNAME_STUFF:ALLOCS_STRUCT


		.CODE	PASS1_TEXT

		EXTERNDEF	COMMON_INST_INIT:PROC,SEARCH_ENTRYNAME:PROC,ENTRYNAME_POOL_GET:PROC,GET_NEW_LOG_BLK:PROC


INIT_ENTRYNAME	PROC
		;
		;
		;
		PUSHM	EDI,EDX

		MOV	EAX,OFF ENTRYNAME_STUFF
		CALL	COMMON_INST_INIT

		CALL	GET_NEW_LOG_BLK

		MOV	EDI,EAX
		MOV	ENTRYNAME_BITS,EAX

		MOV	ECX,8K/4
		XOR	EAX,EAX

		OPTI_STOSD

		POPM	EDX,EDI

;		JMP	INSTALL_ENTRYNAME

INIT_ENTRYNAME	ENDP


INSTALL_ENTRYNAME	PROC
		;
		;EDX IS HASH VALUE, CONVERT IT
		;ES MUST BE DGROUP
		;
		;RETURN DX:AX:BX IS LOGICAL
		;
		;DESTROYS ES,DS,DI,SI,DX,CX
		;
		MOV	EAX,ENTRYNAME_STUFF.ALLO_HASH_TABLE_PTR

		TEST	EAX,EAX
		JZ	INIT_ENTRYNAME

		CALL	SEARCH_ENTRYNAME

		JC	L1$

		RET

L1$:
		;
		;ECX GETS POINTER...
		;
		PUSH	EDI
		MOV	EAX,SYMBOL_LENGTH

		PUSH	ESI
		MOV	ESI,ECX

		ADD	EAX,SIZE ENT_STRUCT-3	;
		CALL	ENTRYNAME_POOL_GET	;ES:DI IS PHYS, AX IS LOG

		PUSH	EBX
		MOV	EBX,EAX

		INSTALL_POINTER_GINDEX	ENTRYNAME_GARRAY

		MOV	EDX,LAST_ENTRYNAME_GINDEX
		MOV	LAST_ENTRYNAME_GINDEX,EAX

		TEST	EDX,EDX
		JZ	L5$

		CONVERT	EDX,EDX,ENTRYNAME_GARRAY
		ASSUME	EDX:PTR ENT_STRUCT

		MOV	[EDX]._ENT_NEXT_ENT_GINDEX,EAX
L51$:
		XOR	EDX,EDX

		MOV	[ESI].ENT_STRUCT._ENT_NEXT_HASH_GINDEX,EAX
		MOV	ESI,OFF SYMBOL_TEXT
		ASSUME	EBX:PTR ENT_STRUCT

		MOV	[EBX]._ENT_NEXT_HASH_GINDEX,EDX
		MOV	[EBX]._ENT_INTERNAL_NAME_GINDEX,EDX

		MOV	ECX,[ESI-4]
		MOV	[EBX]._ENT_ORD,EDX

		SHR	ECX,2
		MOV	DPTR [EBX]._ENT_PWORDS,EDX

		LEA	EDI,[EBX]._ENT_TEXT
		INC	ECX

		OPTI_MOVSD

		MOV	[EBX]._ENT_NEXT_ENT_GINDEX,ECX
		MOV	ECX,EBX

		POPM	EBX,ESI

		INC	ENTRYNAME_COUNT
		POP	EDI

		RET

L5$:
		MOV	FIRST_ENTRYNAME_GINDEX,EAX
		JMP	L51$

INSTALL_ENTRYNAME	ENDP

endif

		END

